import java.util.*;
public class Main {
	public static int fac(int n)
	{
		if(n==0)
			return 1;
		else return fac(n-1)*n;
	}
	public static boolean isInt(String str){
		double num=Double.parseDouble(str);			
		int n=(int)num;
		if((num-n)==0)
		return true;
		else
		return false;
	}
	private static boolean isHexNumber(String str){
		boolean flag = false;
		for(int i=0;i<str.length();i++){
			char cc = str.charAt(i);
			if(cc=='0'||cc=='1'||cc=='2'||cc=='3'||cc=='4'||cc=='5'||cc=='6'||cc=='7'||cc=='8'||cc=='9'||cc=='A'||cc=='B'||cc=='C'||
					cc=='D'||cc=='E'||cc=='F'||cc=='a'||cc=='b'||cc=='c'||cc=='c'||cc=='d'||cc=='e'||cc=='f'){
				flag = true;
			}
		}
		return flag;
	}
	public static void main(String[] args) {
		int m;
		Scanner scanner=new Scanner(System.in);
		String s=scanner.nextLine();
		scanner.close();
		try {
				m=Integer.parseInt(s);
				System.out.println(fac(m));
		}catch(NumberFormatException e) {		
			if(!isInt(s))
			return;
			else if(isHexNumber(s))
			{
				m=Integer.parseInt(s,16);
				System.out.println(fac(m));
		    }
	}
	}
}